Page({
  data: {
    result: '',
    disabled: true
  },
  onLoad:function(){
    
  },
  scanCode: function () {
    var that = this
    wx.scanCode({
      success: function (res) {
        that.setData({
          result: res.result
        })
      },
      fail: function (res) {
      }
    })
  },
  vibrateShort: function () {
      var that = this
      wx.vibrateShort({
          success:function(){
              console.log("震动了");
          }
      })
  },
  bindInput: function (e) {
      this.inputValue = e.detail.value

      if (this.inputValue.length > 0) {
          this.setData({
              disabled: false
          })
      } else {
          this.setData({
              disabled: true
          })
      }
  },
  makePhoneCall: function () {
      var that = this
      wx.makePhoneCall({
          phoneNumber: this.inputValue,
          success: function () {
              console.log("成功拨打电话")
          }
      })
  }
})
